home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
cat3
/
TimerHndlr.3
< prev
next >
Wrap
Text File
|
1994-09-20
|
4KB
|
133 lines
Tk_CreateTimerHandler(3T)k Library Procedures
_________________________________________________________________
NAME
Tk_CreateTimerHandler, Tk_DeleteTimerHandler - call a pro-
cedure at a given time
SYNOPSIS
#include <tk.h>
Tk_TimerToken
Tk_CreateTimerHandler(_m_i_l_l_i_s_e_c_o_n_d_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
Tk_DeleteTimerHandler(_t_o_k_e_n)
ARGUMENTS
int _m_i_l_l_i_s_e_c_o_n_d_s (in) How many mil-
liseconds to wait
before invoking
_p_r_o_c.
Tk_TimerProc *_p_r_o_c (in) Procedure to invoke
after _m_i_l_l_i_s_e_c_o_n_d_s
have elapsed.
ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word
value to pass to
_p_r_o_c.
Tk_TimerToken _t_o_k_e_n (in) Token for
previously-created
timer handler (the
return value from
some previous call
to
Tk_CreateTimerHandler).
_________________________________________________________________
DESCRIPTION
Tk_CreateTimerHandler arranges for _p_r_o_c to be invoked at a
time _m_i_l_l_i_s_e_c_o_n_d_s milliseconds in the future. The callback
to _p_r_o_c will be made by Tk_DoOneEvent, so
Tk_CreateTimerHandler is only useful in programs that
dispatch events through Tk_DoOneEvent or through other Tk
procedures that call Tk_DoOneEvent, such as Tk_MainLoop.
The call to _p_r_o_c may not be made at the exact time given by
_m_i_l_l_i_s_e_c_o_n_d_s: it will be made at the next opportunity after
that time. For example, if Tk_DoOneEvent isn't called until
long after the time has elapsed, or if there are other pend-
ing events to process before the call to _p_r_o_c, then the call
to _p_r_o_c will be delayed.
Tk 1
Tk_CreateTimerHandler(3T)k Library Procedures
_P_r_o_c should have arguments and return value that match the
type Tk_TimerProc:
typedef void Tk_TimerProc(ClientData _c_l_i_e_n_t_D_a_t_a);
The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a
argument given to Tcl_CreateTimerHandler when the callback
was created. Typically, _c_l_i_e_n_t_D_a_t_a points to a data struc-
ture containing application-specific information about what
to do in _p_r_o_c.
Tk_DeleteTimerHandler may be called to delete a previously-
created timer handler. It deletes the handler indicated by
_t_o_k_e_n so that no call to _p_r_o_c will be made; if that handler
no longer exists (e.g. because the time period has already
elapsed and _p_r_o_c has been invoked) then
Tk_DeleteTimerHandler does nothing.
KEYWORDS
callback, clock, handler, timer
Tk 2